import { requireAdmin } from "#server/utils/admin-guard"; import { executeAgentTool } from "#server/service/agent-tool"; export default defineWrappedResponseHandler(async (event) => { const user = await requireAdmin(event); const id = getRouterParam(event, "id"); if (!id) { return R.throwError(400, "无效的工具ID", null); } const body = await readBody(event); const { input } = body; if (input === undefined) { return R.throwError(422, "input 不能为空", null); } const result = await executeAgentTool(id, input, user.id); return R.success(result); });